//
//  XWCell.m
//  CustomizeCellXib
//
//  Created by xiewei on 16/6/18.
//  Copyright © 2016年 xiewei. All rights reserved.
//

#import "XWCell.h"

@interface XWCell()
@property (weak, nonatomic) IBOutlet UIImageView *imgView;

@property (weak, nonatomic) IBOutlet UILabel *labelStr;
@end

@implementation XWCell

+ (instancetype)xwcellWithTableView:(UITableView *)tableview {
    NSString *reuseID = @"xwcell";
    XWCell *cell = [tableview dequeueReusableCellWithIdentifier:reuseID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"XWCell" owner:nil options:nil] lastObject];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

#pragma mark - 重写setter方法
- (void)setDict:(NSDictionary *)dict {
    /// 给本方法对应成员变量赋值
    _dict = dict;
    
    /// 给子控件赋值
    self.imageView.image = [UIImage imageNamed:_dict[@"img"]];
    self.labelStr.text = _dict[@"index"];
}
@end
